import {
  WHETHER_OPTION,
  STOCK_ATTR_OPTION,
  DEMAND_TYPE_OPTION,
} from '@sourcing/constants';
export const TAB_LISTS = [
  { title: '全部状态', name: '' },
  { title: '询价中', name: '100' },
  { title: '询价完成', name: '400' },
  { title: '询价取消', name: '500' },
]
export const FORM_ITEMS = [
  {
    prop: 'originCode',
    label: '来源单据号',
    type: 'input'
  },
  {
    prop: 'sourceBillNo',
    label: '询价单号',
    type: 'input'
  },
  {
    prop: 'productBrand',
    label: '品牌',
    type: 'input'
  },
  {
    prop: 'skuCode',
    label: '商品代码',
    type: 'input'
  },
  {
    prop: 'purchaseSkuName',
    label: '采购商品名称',
    type: 'input'
  },
  {
    prop: 'purchaseInquirerCompanyName',
    label: '采购询价公司',
    type: 'input'
  },
  {
    prop: 'purchaseInquirerName',
    label: '采购询价人',
    type: 'input'
  },
  {
    prop: 'serviceProviderName',
    label: '指定渠道名称',
    type: 'input'
  },
  {
    prop: 'isProcedures',
    label: '是否走手续',
    type: 'select',
    options: WHETHER_OPTION
  },
  {
    prop: 'isServiceProvider',
    label: '是否服务商',
    type: 'select',
    options: WHETHER_OPTION
  },
  {
    prop: 'stockAttr',
    label: '存量属性',
    type: 'select',
    options: STOCK_ATTR_OPTION
  },
  {
    prop: 'demandType',
    label: '需求类型',
    type: 'select',
    options: DEMAND_TYPE_OPTION
  },
  {
    prop: 'categoryCode',
    label: '分类',
    type: 'category'
  },
]

export const getTableColumns = (parent) => {
  return [
    {
      prop: 'creationDate',
      label: '制单时间',
      width: 140
    },
    {
      prop: 'reqSourcingDate',
      label: '要求采购询价时间',
      width: 140
    },
    {
      prop: 'billStatusName',
      label: '询价状态',
    },
    {
      prop: 'originCode',
      label: '来源单据号',
      width: 140
    },
    {
      prop: 'sourceBillNo',
      label: '询价单号',
      width: 140
    },
    {
      prop: 'purchaseInquirerCompanyName',
      label: '采购询价公司',
      width: 100
    },
    {
      prop: 'saleCompanyName',
      label: '销售公司',
      width: 100
    },
    {
      prop: 'shippingCompanyName',
      label: '发货公司',
      width: 100
    },
    {
      prop: 'isProceduresStr',
      label: '是否走手续',
      width: 100
    },
    {
      prop: 'isServiceProviderStr',
      label: '是否服务商',
      width: 100
    },
    {
      prop: 'serviceProviderName',
      label: '指定渠道名称',
      width: 120
    },
    {
      prop: 'mark',
      label: '备注',
    },
    {
      prop: 'creatorName',
      label: '上游制单人',
    },
    {
      prop: 'purchaseInquirerName',
      label: '采购询价人',
    },
    {
      prop: 'deliveryAddress',
      label: '送货地址',
    },
    {
      prop: 'stockAttrStr',
      label: '存量属性',
    },
    {
      prop: 'demandTypeStr',
      label: '需求类型',
    },
    {
      prop: 'skuCode',
      label: '商品代码',
    },
    {
      prop: 'skuName',
      label: '商品名称',
    },
    {
      prop: 'categoryCode',
      label: '分类代码',
    },
    {
      prop: 'categoryName',
      label: '分类名称',
    },
    {
      prop: 'purchaseSkuName',
      label: '采购商品名称',
    },
    {
      prop: 'productBrand',
      label: '品牌',
    },
    {
      prop: 'productSpec',
      label: '商品规格',
    },
    {
      prop: 'unit',
      label: '计量单位',
    },
    {
      prop: 'amount',
      label: '数量',
    },
    {
      prop: 'sellMark',
      label: '销售备注',
    },
    {
      prop: 'reqQualification',
      label: '资质要求',
    },
    {
      prop: 'fileGroupId',
      label: '附件',
      render: (h, { row }) => {
        if (row.fileGroupId && row.fileGroupId != '0') {
          return <el-link onClick={() => parent.handleViewFileList(row)} type="primary">查看附件</el-link>
        }
      }
    },
  ]
}
